/*
 *  $Id: Abstract.cs 1245 2011-03-23 14:11:04Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008-2009 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima {
    public abstract class GameMode {
        private Events.EventQueue _events;

        public GameMode() {
            _events = new Events.EventQueue();
        }

        public virtual bool Master {
            get { return true; }
        }

        public virtual PlayerInfo Player1 {
            get { return null; }
        }
        public virtual PlayerInfo Player2 {
            get { return null; }
        }

        public Events.EventQueue Queue {
            get { return _events; }
        }

        public abstract Player GetMainPlayer(bool side, Player player1, Player player2);

        public virtual void AddEvent(Events.AbstractEvent ev) {
            _events.Enqueue(ev);
            // FIXME : temporary event log
            ev.WriteToConsole("Add");
        }

        public virtual void ProcessEvents(OldScene scene) {
            while (!_events.Empty) {
                Events.AbstractEvent ev = _events.Dequeue();
                ev.Execute(scene);
            }
        }
    }
}
